<%@ page import="java.sql.*" %>
<%@ page import="edu.njfu.javawebdemo.dao.UserDao" %>
<%@ page import="edu.njfu.javawebdemo.model.User" %><%--
  Created by IntelliJ IDEA.
  User: guzhe
  Date: 2020/12/8
  Time: 15:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
//获取用户名和密码
    String userName=request.getParameter("username");
    String password=request.getParameter("password");
    //创建UserDao对象
    UserDao userDao=new UserDao();
    if (userDao.checkLogin(new User(userName,password))){
    session.setAttribute("user",userName);
    response.sendRedirect("shows2.jsp");
    }else{
        out.println("<script>alert('用户名密码错误');location.href='login.html'</script>");
    }
%>